In general, graphics rendering may generate an image or images from model data using a wide range of computer implemented techniques. In some graphics rendering implementations, multi-sampling anti-aliasing (MSAA) techniques may be used to improve the visual quality of the rendered image(s) using, in some examples, a graphics processor. For example, MSAA techniques may reduce or eliminate jagged edge effects in images and crawling effects in sequence of images. In MSAA, multiple visibility samples, color samples, and/or depth samples may be used per pixel. Such oversampling or super-sampling (e.g., using more than one sample per pixel) and subsequent sample reduction to produce a final image may improve image or video quality. In general, an advantage of MSAA is that although there are multiple samples per pixel, the pixel shader (e.g., a program that provides shading within an image) only needs to be evaluated once per pixel. A common case is 4×MSAA, where there are four samples per pixel (e.g., 4 samples per pixel) as compared to the usual case of one sample per pixel. Other common use cases are 8 samples per pixel (8×MSAA) and 16 samples per pixel (16×MSAA). However, as will be appreciated, the techniques discussed herein may be applied to any number of samples per pixel.
In general, using MSAA requires a color buffer bandwidth increase by a factor of N for N×MSAA. Therefore, compression of MSAA color data may be advantageous. In previous implementations, the colors may be split into N different planes, such that plane 0 is filled first and subsequent planes are used or filled as needed. For example, if all of the samples a pixel are the same color, then that pixel only fills color plane 0. If the samples of a pixel include two colors, planes 0 and 1 are utilized, and, in general, if the samples of a pixel include N colors, planes 0 through N−1 are utilized. Further, if each pixel in a tile of pixels, for example, uses only one color each (though the colors between pixels may be different), then only plane 0 may be used for the tile of pixels. However, if one pixel of the tile includes two colors (for the samples of that pixel), then plane 1 must be used. If more than one (or all) of the pixels use only two colors each, plane 1 is sufficient, but if one (or more) pixels uses three colors, plane 2 must be used, and so on. In such a manner the color planes may be populated as needed based on the samples within each pixel of a tile of pixels.
Further, in general, each color sample within a pixel needs log2(N) bits to “point” to a color in the N different planes (e.g., for 4 color planes, 2 pointer bits are needed for each color sample). For example, if two color planes (planes 0 and 1) are used, for each color sample within a pixel, a pointer must be used to indicate the plane on which the color resides for that sample. In the case of 4×MSAA, each sample would need 2 index bits to point to a color being located in one of the (up to) 4 planes. For a tile of 8×4 pixels with 4 samples per pixel, the requirement is 2×8×4×4=256 bits for the index bits.
In general, if a pixel is completely inside a triangle being rendered, then all samples within the pixel will have the same color and the index or pointer bits will all be zeros for that pixel (because they will point to color plane 0 and index bits 00 point to color plane 0, for example). Further, nothing will be stored in the remaining color planes for that pixel as described above. Therefore, in some cases, only plane 0 is needed. Remaining color planes may be used more frequently as the complexity of the geometry being rendering into a tile (e.g., a tile of 8×4 pixels) increases. Tests indicate that higher level color planes are frequently used in some scenes. In general, it may be advantageous to compress color data such that a minimum number of color planes are used to save color buffer bandwidth, for example.